<template>
  <u-container-layout>
    <zlrt-table :p="ctx">
      <template #before>
        <zlrt-search :p="ctx">
          <!-- <template #ownerName>
            <el-select v-model="ctx.filter.ownerId" placeholder="请选择货主">
              <el-option v-for="ite in ownerOptions" :key="ite.id" :label="ite.name" :value="ite.id" />
            </el-select>
          </template> -->
          <template v-slot:filter>
            <el-form-item label="物料名称" prop="skuName">
              <el-input v-model="ctx.otherFilter.skuName" placeholder="请输入物料名称" />
            </el-form-item>
          </template>
        </zlrt-search>
        <div class="tool-bar">
          <el-button type="danger" v-hasPermit="['wms:goods:del']" icon="Delete" :disabled="!ctx.selected.length"
            @click="ctx.batchDelete()">
            批量删除
          </el-button>
          <span style="float:right">
            <el-button type="success" v-hasPermit="['wms:goods:list']" :loading="ctx.exportLoading" icon="Download"
              @click="ctx.export()">
              导出
            </el-button>
            <el-button type="primary" v-hasPermit="['wms:goods:save']" icon="Plus" @click="ctx.showEdit()">
              添加
            </el-button>
          </span>
        </div>
      </template>
      <template v-slot:isComplete="scope">
        {{ ctx.other.getComplete(scope.row.isComplete) }}
      </template>
      <template v-slot:operation="scope">
        <el-button type="primary" v-hasPermit="['wms:goods:save']" link size="small" icon="Edit"
          @click="ctx.showEdit(scope.row)">
          编辑
        </el-button>
        <el-button type="danger" v-hasPermit="['wms:goods:del']" link size="small" icon="Delete"
          @click="ctx.del(scope.row.id)">
          删除
        </el-button>
      </template>
      <template #after>
        <el-dialog v-model="ctx.editVisible" :title="ctx.editAction + ctx.title" width="600px" append-to-body
          :close-on-click-modal="false" @close="ctx.closeEdit()">
          <el-form :ref="(e) => ctx.formRef = e" :model="ctx.editData" :rules="ctx.rules" v-loading="ctx.editLoading"
            label-width="120px" class="demo-ruleForm">
            <el-form-item label="物料编码" prop="barCode">
              <el-input v-model="ctx.editData.barCode" placeholder="请输入物料编码" />
            </el-form-item>
            <el-form-item label="物料名称" prop="skuName">
              <el-input v-model="ctx.editData.skuName" placeholder="请输入物料名称" />
            </el-form-item>

            <!-- <el-form-item label="标号" prop="skuCode">
              <el-input v-model="ctx.editData.skuCode" placeholder="请输入标号" />
            </el-form-item> -->

            <!-- <el-form-item label="分类" prop="category">
              <el-input v-model="ctx.editData.category" placeholder="请输入分类" />
            </el-form-item> -->

            <el-form-item label="规格型号" prop="specification">
              <el-input v-model="ctx.editData.specification" placeholder="请输入规格型号" />
            </el-form-item>

            <el-form-item label="单位" prop="unit">
              <el-input v-model="ctx.editData.unit" placeholder="请输入单位" />
            </el-form-item>

            <!-- <el-form-item label="货主" prop="ownerId">
              <el-select v-model="ctx.editData.ownerId" placeholder="请选择货主" @change="ctx.other.handleOwnerChange">
                <el-option v-for="ite in ownerOptions" :key="ite.id" :label="ite.name" :value="ite.id" />
              </el-select>
            </el-form-item> -->

            <!-- <el-form-item label="整货/散货" prop="isComplete">
              <el-select v-model="ctx.editData.isComplete" placeholder="请选择整货/散货">
                <el-option v-for="ite in isCompleteOptions" :key="ite.value" :label="ite.label" :value="ite.value" />
              </el-select>
            </el-form-item> -->
            <el-form-item label="单价（¥）" prop="price">
              <el-input type="number" v-model="ctx.editData.price" placeholder="请输入单价" />
            </el-form-item>
            <el-form-item label="预警数量" prop="alertNumber">
              <el-input type="alertNumber" v-model="ctx.editData.alertNumber" placeholder="请输入预警数量" />
            </el-form-item>
            <!-- <el-form-item label="库存" prop="number">
              <el-input type="number" v-model="ctx.editData.number" placeholder="请输入库存" />
            </el-form-item> -->
            <!-- <el-form-item label="保质期（天）" prop="termValidity">
              <el-input v-model="ctx.editData.termValidity" placeholder="请输入保质期" />
            </el-form-item>
            
            <el-form-item label="长（cm）" prop="length">
              <el-input v-model="ctx.editData.length" placeholder="请输入长" />
            </el-form-item>
            <el-form-item label="宽（cm）" prop="width">
              <el-input v-model="ctx.editData.width" placeholder="请输入宽" />
            </el-form-item>
            <el-form-item label="高（cm）" prop="height">
              <el-input v-model="ctx.editData.height" placeholder="请输入高" />
            </el-form-item>
            <el-form-item label="毛重（kg）" prop="grossWeight">
              <el-input v-model="ctx.editData.grossWeight" placeholder="请输入毛重" />
            </el-form-item> -->
          </el-form>
          <template #footer>
            <span class="dialog-footer">
              <el-button @click="ctx.editVisible = false">取消</el-button>
              <el-button type="primary" @click="ctx.save()">确定</el-button>
            </span>
          </template>
        </el-dialog>
      </template>
    </zlrt-table>
  </u-container-layout>
</template>

<script lang="ts" src="./goods" />

<style lang="scss" scoped>

</style>
